<?php

include '../connectBDD.php';
if (isset($_GET['login'])) {
    $login = $_GET['login'];
    $query = "DELETE FROM user WHERE login = '$login'";

    mysql_query($query) or die(mysql_error());

    //Recherche Personnes
    $result = mysql_query("SELECT login FROM User where type = 'U'");
    $nb_res = mysql_num_rows($result);
    echo "<div style='color:green'>$nb_res membre(s) trouvé(s)</div>";

    if (mysql_num_rows($result) <= 0) {
        echo "<div class='no_result_found'>Aucun membre.</div>";
    } else {
        echo "<div class='utilisateurs'>";

        if (mysql_num_rows($result) <= 0) {
            echo "<div class='no_result_found'>Aucun membre.</div>";
        } else {
            while ($row = mysql_fetch_assoc($result)) {
                echo"
                         <div id='utilisateur'>
                            <a href='../profil.php?login=" . $row['login'] . "'>" . $row['login'] . "</a>
                            <a class='croix_ferm' href=\"javascript:supprimerUtilisateur('" . $row['login'] . "')\"><img src='../images/Close-32.png' height='15px' width='15px'/></a>
                         </div>";
            }
            echo "</div>";
        }
    }
}
?>
